﻿@model JPSOFTWARE.BON.Modelos.LoginModel
@{
    Layout = "~/Views/Shared/_Layout.cshtml";

    AjaxOptions ajax = new AjaxOptions
    {
        OnBegin = "Inicio()",
        LoadingElementId = "divLoading",
        OnSuccess = "Sucesso()",
        OnFailure = "Erro()"
    };
}
@{
    ViewBag.Title = "Bebida Social - Recuperar Senha";
}
<script src="@Url.Content("~/Scripts/recuperarSenha.js")" type="text/javascript"></script>
<script type="text/javascript">
    function Sucesso() {
        $("#divLoading").dialog("close");
        AbrirPopUp("#divRecuperarSenhaSucesso");
    }
    function Erro() {
        $("#divLoading").dialog("close");
        AbrirPopUp("#divRecuperarSenhaErro");
    }
    function Inicio() {
        $("#divLoading").dialog("open");
    }
    $(document).ready(function () {
        FormularioRecuperarSenha();

        $('#divLoading').dialog({
            title: "Bebida Social - Recuperar Senha",
            autoOpen: false,
            draggable: false,
            resizable: false,
            closeOnEscape: false,
            modal: true,
            open: function () { $(".ui-dialog-titlebar-close").hide(); } // Hide close button
        });
    });
</script>
<div class="span4">
</div>
<div class="span4 box">
    <div class="box-head">
        <h3>
            Recuperação de Senha</h3>
    </div>
    <div class="box-content">
        <div class="content-inner">
            <div class="form">
                @using (Ajax.BeginForm("RecuperarSenha", "Login", ajax))
                {
                    @Html.Hidden("hEmailEnviado", ViewData["emailEnviado"])

                    @Html.ValidationSummary(true)
                                    
                    <div class="control-group">
                        <div class="control-label">
                            @Html.LabelFor(model => model.EmailLogin)
                        </div>
                        <div class="controls">
                            @Html.TextBoxFor(model => model.EmailLogin, new { @class = "input-xlarge", MaxLength = 50 })
                            <p>
                                @Html.ValidationMessageFor(model => model.EmailLogin)</p>
                        </div>
                    </div>
                    <div class="form-actions">
                        <input class="btn btn-primary" type="submit" value="Recuperar" />
                        @Html.ActionLink("Cancelar", "LogOn", "Login", new { @class = "btn" })
                    </div>                
                }
            </div>
        </div>
    </div>
</div>
<div class="span4">
</div>
<div class="modal" id="divRecuperarSenhaSucesso">
    <div class="modal-header">
        <h3>
            Recuperação de Senha</h3>
    </div>
    <div class="modal-body">
        @JPSOFTWARE.BON.Modelos.Mensagens.MSG_010
    </div>
    <div class="modal-footer">
        <span>@Html.ActionLink("OK", "LogOn", null, new { @class = "btn btn-primary" })</span>
    </div>
</div>
<div class="modal" id="divRecuperarSenhaErro">
    <div class="modal-header">
        <h3>
            Recuperação de Senha</h3>
    </div>
    <div class="modal-body">
        <img src="@Url.Content("~/Content/bootstrap/img/danger.png")" alt=""/>@JPSOFTWARE.BON.Modelos.Mensagens.MSG_009
    </div>
    <div class="modal-footer">
        <span>@Html.ActionLink("Tentar Novamente", "RecuperarSenha", null, new { @class = "btn btn-primary" })</span>
        <span>@Html.ActionLink("Cancelar", "LogOn", null, new { @class = "btn" })</span>
    </div>
</div>
<div id="divLoading" style="text-align: center; padding: 50px; display: none">
    <p>
        Processando...
    </p>
    <img src="@Url.Content("~/Content/bootstrap/img/ajax-loader.gif")" />
</div>
